<template>
    <div id="app">
        <!--左侧菜单-->
        <LeftMenu v-if="showMenu"/>
        <!--主内容-->
        <div class="content">
            <router-view v-if="isRouterAlive"></router-view>
        </div>
        <promise-dialog v-if="isShowPromise"></promise-dialog>
    </div>
</template>

<script>
    import LeftMenu from '@/components/left-menu'
    import PromiseDialog from '@/components/promise-dialog'

    export default {
        name: 'app',
        provide(){
            return {
                reload: this.reload
            }
        },
        components: {
            LeftMenu,
            PromiseDialog,
        },
        data() {
            return {
                isRouterAlive:true
            };
        },
        computed: {
            showMenu() {
                const {name, meta} = this.$route;
                document.title = this.$tc(meta.title);
                return name && name !== 'login';
            },
            isShowPromise() {
                const { path } = this.$route;
                const urls = ['/conf/collection/pre-order-manage/wait-assign','/conf/collection/pre-order-manage/wait-list','/conf/collection/pre-order-manage/processed-list','/conf/collection/pre-order-manage/returned-list'];
                return urls.indexOf(path) >= 0;
            }
        },
        methods: {
            reload(){
                this.isRouterAlive=false;
                this.$nextTick(()=>{
                    this.isRouterAlive = true;
                })
            }
        }
    }
</script>

<style lang="scss" scoped>
    .content {
        flex: 1;
        //overflow: auto;
        overflow-y: auto;
        overflow-x: hidden;
    }
</style>
<style>
    .el-popper {
        max-width:800px;
        word-wrap:break-word;
    }
    .el-message {
        max-width:800px;
        word-wrap:break-word;
        word-break:break-all;
    }
</style>
